/*MyPhotoIndex Free Photo Organizer <www.myphotoindex.com>
  Copyright (C) <2006-2009>  <Asaf Yarkoni asaf@yarkoni.net>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;
using MyPhotoIndex.Interfaces.Imaging;

namespace MyPhotoIndex.Interfaces.ImageFormatProviders
{
    public interface IImageFormatProvider
    {
        string Extention { get;}

        bool IsVideo { get;}

        bool IsCachable { get;}

        /// <summary>
        /// Retrieves the image metadata from the image media
        /// </summary>
        /// <returns>IImageMetadata driven object containing all relevant data</returns>
        IImageMetaData GetImageMetaData(string fileName);
        void SetImageMetaData(IImageData imageData, String fileName);


        /// <summary>
        /// generate a thumbnail from the image media
        /// </summary>
        /// <remarks>The returned image should be disposed when no longer needed.</remarks>
        /// <returns>Image</returns>
        Image GetThumbnail(string fileName, Size size);

        Image LoadImage(IImageData imageData);
        Image LoadImage(IImageData imageData, Size requestedSize);

        bool CanRotate { get;}
        void Rotate(string fileName, RotateFlipType rotationType, out Image thumbnail, out Size newImageSize);

        bool CanSave { get;}

        void SaveImage(Image image, IImageData imageData, String fileName);
        void SaveImage(Image image, IImageData imageData, Stream stream);

        /// <summary>
        /// Get the DateTime object indicating the time that this image media has been last changed
        /// </summary>
        /// <remarks>When using the default provider this will indicate the last modified date of the image file</remarks>
        /// <returns>DateTime object indicating update Date and Time</returns>
        DateTime GetImageMediaLastUpdated(string fileName);
        /// <summary>
        /// Get the file signatue for this image
        /// </summary>
        /// <remarks>The signature is usually a hash value generated by an MD5 algo.</remarks>
        /// <returns>String containing a unique file signature</returns>
        string GetImageMediaSignature(string fileName);
        /// <summary>
        /// Check if the file exists on media.
        /// </summary>
        /// <returns>bool value indicating that the file exists on media</returns>
        bool Exists(string path);

        bool CanDelete(string path);
        void Delete(string path);

        /// <summary>
        /// Copy the media to the specified location.
        /// </summary>
        /// <returns>void</returns>
        void CopyTo(IImageData imageData, string newMediaPath);
    }
}
